import request from '@/api/utils/request';

/**
 * 获取宿舍楼
 * @returns
 *   name         宿舍楼名称
 *   totalStorey   楼层数
 */
// export const getDormitory = () =>
//   request({
//     method: 'get',
//     url: '/schDormitory/getDormitoryList'
//   });
export const getUserInfo = data =>
  request({
    method: 'get',
    url: '/schTeacherDormitoryRelation/getUserInfo',
    data
  });
export const getDormitory = data =>
  request({
    method: 'get',
    url: '/schDormitory/getDormitoryList?dormitoryType=' + data
  });
// 查全部宿舍楼
export const getDormitoryAll = () =>
  request({
    method: 'get',
    url: '/schDormitory/getDormitoryList'
  });
/**
 * 获取楼层
 * @returns
 */
export const floorList = id =>
  request({
    method: 'get',
    url: `/schStudentDormitoryRelation/floorList?dormitoryId=${id}`
  });

/**
 * 获取楼层房间
 * @returns
 */
export const floorRoom = (dormitoryId, storey) =>
  request({
    method: 'get',
    url: `/schStudentDormitoryRelation/floorRoom?dormitoryId=${dormitoryId}&storey=${storey}`
  });

/**
 * 获取楼层房间
 * @returns
 */
export const dormitoryRoomList = (dormitoryId, storey) =>
  request({
    method: 'get',
    url: `/schDormitoryRoom/getDormitoryRoomList?dormitoryId=${dormitoryId}&storey=${storey}`
  });

/**
 * 获取楼层房间详情,不包含停用,不包含已分配
 * @returns
 */
export const getRoomBedInfo = data =>
  request({
    method: 'get',
    url: '/schDormitoryRoom/getRoomBedInfo',
    params: data
  });

/**
 * 获取楼层房间详情,不包含停用
 * @returns
 */
export const getRoomAllBedInfo = data =>
  request({
    method: 'get',
    url: '/schDormitoryRoom/getRoomAllBedInfo',
    params: data
  });

/**
 * 获取楼层房间详情
 * @returns
 */
export const roomDetails = id =>
  request({
    method: 'get',
    url: `/schDormitoryRoom/getRoomDetails/${id}`
  });
/**
 * 获取年级
 * @returns
 */
export const gradeList = async () =>
  await request({
    method: 'get',
    url: '/schStudentDormitoryRelation/gradeList'
  });

/**
 * 获取年级
 * @returns
 */
export const gradeListNew = data =>
  request({
    method: 'get',
    url: `/schStudentDormitoryRelation/gradeList?sectionCode=${data}`
  });
/**
 * 获取班级
 * @returns
 */
export const classList = id =>
  request({
    method: 'get',
    url: '/schStudentDormitoryRelation/classList',
    params: id
  });

/**
 * 获取房间
 * @returns
 */
export const roomList = id =>
  request({
    method: 'get',
    url: '/schStudentDormitoryRelation/roomList',
    params: id
  });

/**
 * 获取房间
 * @returns
 */
export const bedList = id =>
  request({
    method: 'get',
    url: `/schStudentDormitoryRelation/bedList?roomId=${id}`
  });

/**
 * 就近原则
 * @returns
 */
export const defaultReveal = (id, gender, gradeId) =>
  request({
    method: 'get',
    url: `/schStudentDormitoryRelation/defaultReveal?classId=${id}&gender=${gender}&gradeId=${gradeId}`
  });

/**
 * 房间床位数
 */
export const roomBedNum = () =>
  request({
    method: 'get',
    url: '/schDormitoryRoom/getRoomNum'
  });

/**
 * 登录
 */
export const login = () =>
  request({
    method: 'post',
    url: '/oauth/token',
    data: {
      username: '17863007235',
      password: '666666',
      grant_type: 'password'
    },
    headers: {
      'Content-Type': 'multipart/form-data',
      Authorization: 'Basic ZmViczoxMjM0NTY='
    }
  });

/**
 * 权限相关
 */
export const getCurrentUserPower = () =>
  request({
    method: 'get',
    url: '/schExamineMark/getCurrentUserPower'
  });
/**
 * 获取教师
 */
export const getHeadTeacherClassList = async () =>
  await request({
    method: 'get',
    url: '/schExamineMark/getHeadTeacherClassList'
  });

/**
 * IS管理
 */
export const checkCurrentUserIsAdmin = id =>
  request({
    method: 'get',
    url: `/schExamineMark/checkCurrentUserIsAdmin/${id}`
  });
/**
 * 获取学段
 * @returns
 */
export const getSectionCodeList = () =>
  request({
    method: 'post',
    url: '/schStudentDormitoryRelation/getSectionCodeList'
  });
/**
 * 获取年级
 * @returns
 */
export const gradeListSection = async sectionCode =>
  await request({
    method: 'get',
    url: `/schStudentDormitoryRelation/gradeList?sectionCode=${sectionCode}`
  });
/**
 * 看是不是兴隆定制校区
 */
export const getCustomizedStatus = () =>
  request({
    method: 'get',
    url: '/schCustomized/getCustomizedStatus'
  });
/**
 * 获取学段下的所有班级id
 */
export const getSectionCodeClassIds = sectionCode =>
  request({
    method: 'get',
    url: `/schClassInfo/getSectionCodeClassIds?sectionCode=${sectionCode}`
  });
